package com.dz.xjd;

import com.dz.xjd.api.ApiServiceTest;
import com.dz.xjd.app.UrlValue;
import com.dz.xjd.params.Params;
import com.dz.xjd.utils.fastjson.FastJsonConverterFactory;
import org.junit.Test;
import retrofit2.Response;
import retrofit2.Retrofit;

/**
 * Created by dz on 2017/7/24.
 */

public class GetToken {
    @Test
    public void test(){
        ApiServiceTest apiServiceTest = new Retrofit.Builder()
                .baseUrl(UrlValue.URL)
                .addConverterFactory(FastJsonConverterFactory.create())
                .build().create(ApiServiceTest.class);
        try {
            /*{
                "clientVersion": "2.0",
                    "deviceId": "1234567890",
                    "from": "ios",
                    "method": "token",
                    "userId": 0
                    kXlIAiPvAo6sbC46kt8DI3wsAMiRFp
            }*/

            String header = Params.tokenHeadParams();
            System.out.println(header);
            Response<String> response = apiServiceTest.getToken(header).execute();
            String str = response.body();
            System.out.print(str);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
